﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Core
{
    public static partial class problem
    {
        public static dynamic getPIDPoint(int pid, bool god)
        {
            var sql = new Sql.SqlDataContext();
            if (!sql.Problem.Any(row => row.pid == pid)) return new
                 {
                     success = false,
                     msg = "题目不存在"
                 };
            var point = sql.Problem.Count(row => row.pid < pid && (god || !row.disabled));
            return new
            {
                success = true,
                point
            };
        }
    }
}
